package com.xiangyang.pos.bean;

import android.util.Log;

import com.google.gson.Gson;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2017/11/1 0001.
 *
 * 订单列表数据源
 *
 */

public class OrderListDataBean {

    private int status;

    private List<OrderListData> data;

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public List<OrderListData> getData() {
        return data;
    }

    public void setData(List<OrderListData> data) {
        this.data = data;
    }

    public class OrderListData{
        private int id;
        private String ordercode;
        private int shopid;
        private String addtime;
        private List<OrderData> list;
        private String content;
        private double free;
        private int status;

        public double getFree() {
            return free;
        }

        public void setFree(double free) {
            this.free = free;
        }

        public int getStatus() {
            return status;
        }

        public void setStatus(int status) {
            this.status = status;
        }

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getOrdercode() {
            return ordercode;
        }

        public void setOrdercode(String ordercode) {
            this.ordercode = ordercode;
        }

        public int getShopid() {
            return shopid;
        }

        public void setShopid(int shopid) {
            this.shopid = shopid;
        }

        public String getAddtime() {

            String timeString = null;
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd   HH:mm:ss");
            long  l = Long.valueOf(addtime);
            Log.e("xxxx","time =  "+l);
            timeString = sdf.format(new Date(l*1000));//单位秒


            return timeString;
        }

        public void setAddtime(String addtime) {
            this.addtime = addtime;
        }

        public List<UserOrderData> getContent() {
            Gson gson=new Gson();
            String str="{\"list\":"+content+"}";
            Log.e("xxxx","  ***   "+str);
//            list= (List<OrderData>) gson.fromJson(content,OrderData.class);
            ListData data=gson.fromJson(str,ListData.class);
            return data.list;
        }

        public void setContent(String content) {
            this.content = content;
        }
    }

    public class OrderData{
        private String price;
        private String code;
        private String title;
        private String num;
        private String measurement;
        private String unit;

        public String getMeasurement() {
            return measurement;
        }

        public void setMeasurement(String measurement) {
            this.measurement = measurement;
        }

        public String getUnit() {
            return unit;
        }

        public void setUnit(String unit) {
            this.unit = unit;
        }

        public String getPrice() {
            return price;
        }

        public void setPrice(String price) {
            this.price = price;
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getNum() {
            return num;
        }

        public void setNum(String num) {
            this.num = num;
        }
    }

    public class ListData{
        private List<UserOrderData> list;

        public List<UserOrderData> getList() {
            return list;
        }

        public void setList(List<UserOrderData> list) {
            this.list = list;
        }
    }


    public class UserOrderData{
        private String id;
        private String address;
        private String title;
        private String phone;
        private List<OrderData> shopgoods;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getAddress() {
            return address;
        }

        public void setAddress(String address) {
            this.address = address;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getPhone() {
            return phone;
        }

        public void setPhone(String phone) {
            this.phone = phone;
        }

        public List<OrderData> getShopgoods() {
            return shopgoods;
        }

        public void setShopgoods(List<OrderData> shopgoods) {
            this.shopgoods = shopgoods;
        }
    }

}
